from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

# 创建路由器并注册视图
router = DefaultRouter()
router.register(r'user', views.UserViewSet)
router.register(r'objectives', views.ObjectiveViewSet)
router.register(r'key-results', views.KeyResultViewSet)
router.register(r'check-ins', views.CheckInViewSet)
router.register(r'teams', views.TeamViewSet)
router.register(r'comments', views.CommentViewSet)

# 定义URL模式
urlpatterns = [
    path('', include(router.urls)),
    path('auth/login/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('auth/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('auth/register/', views.RegisterView.as_view(), name='register'),
    path('auth/test/', views.AuthTestView.as_view(), name='auth_test'),
]
